/*
 * All rights Reserved, Designed By Rylynn
 * @ClassName:  JobManager
 * @Description:
 * @author: rylynn
 * @date:   2021/7/14
 *
 */

package org.etnetwork.engine;

import org.checkerframework.checker.nullness.Opt;

import java.nio.file.Files;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ExecutorService;

public class JobManager {
    private ExecutorService executors;
    private Map<Long, Job> jobs;

    public void addJob(Long id, Job job) {
        jobs.put(id, job);
    }

    public Optional<Job> getJob(Long id) {
        if (this.jobs.get(id) == null) {
                return Optional.empty();
        }
        return Optional.of(this.jobs.get(id));
    }

    public Job getJob(int index) {
        return jobs.get(index);
    }

    public void startJob(Long index) {

    }

    private ExecutorService executor;

    private JobManager() {
        this.jobs = new HashMap<>();

    }
    public JobManager buildFromYaml(Files file) {

        return new JobManager();
    }

    public static void main(String[] args) {

    }
}
